package com.wontube.smr.remote;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.wontube.core.annotation.NoLoginSupport;
import com.wontube.core.pub.servlet.handlers.BasicHandler;
import com.wontube.smr.bo.pub.ProxyHttpBO;
import com.wontube.smr.client.IProxyHandler;

@NoLoginSupport
public class ProxyHandler extends BasicHandler implements IProxyHandler {
	@Override
	public String fetchHuluPlayHtml(String playUrl) {
		if (playUrl == null || !playUrl.startsWith("http://s.hulu.com/select?")) {
			return "";
		}
		
		Map<String, String> map = new HashMap<String, String>();
		map.put("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
		
		String html = "";
		try {
			html = ProxyHttpBO.fectchHtml(playUrl, map);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		
		return html;
	}

}
